package com.lry.basic.design_mode.observer.demo1;

public class ObserverPatternDemo {
   public static void main(String[] args) {
      Subject subject = new Subject();//被观察者

      //三个观察者
      new HexObserver(subject);
      new OctalObserver(subject);
      new BinaryObserver(subject);
 
      System.out.println("First state change: 15");   
      subject.setState(15);//被观察者 改变 触发三个观察者update事件

      System.out.println("Second state change: 10");  
      subject.setState(10);//被观察者 改变 触发三个观察者update事件
   }
}
